package com.itheima.a14waitandnotify;

import java.util.concurrent.ArrayBlockingQueue;

public class Cook extends Thread {

    ArrayBlockingQueue<String> queue ;
    public Cook(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }

    public void run() {
        while(true) {
            try {
                String food = queue.take() ;
                System.out.println(food);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

}
